const BaseController = require("../base");

const db = require('../../database/dbquery')

const UserModel = require('../../model/user')


class UserController extends BaseController {
    constructor(){}
    static async getUser(ctx) {
        // let sql = `select * from user where status=1`
        // const res = await db.query(sql)
        const res = await UserModel.findAll()
        ctx.body = BaseController.renderJsonSuccess(200, res)
    }
    
    static async getUserDetail(ctx) {
        const id = ctx.params.id
        let msg = '输入错误'
        let code = 200
        if (parseInt(id) === 666) {
            msg = '输入正确'
        }
        ctx.body = BaseController.renderJsonSuccess(code, msg, id)
    }
}
module.exports = UserController
